﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ProductListNew.aspx.cs" Inherits="Maticsoft.Web.ProductListNew" %>
<%@ Register Src="Header.ascx" TagName="Header" TagPrefix="uc1" %>
<%@ Register Src="footer.ascx" TagName="footer" TagPrefix="uc2" %>
<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/img/icon.png" rel="icon" type="images/png" sizes="16*16" />
    <title>热门产品</title>
    <link rel="stylesheet" href="css/reset.css" />
    <link rel="stylesheet" href="css/common.css" />
    <style type="text/css">
        .pages
        {
            color: #999;
            overflow: auto;
        }
        .pages a, .pages .cpb
        {
            text-decoration: none;
            float: left;
            padding: 8px;
            border: 1px solid #ddd;
            background: #ffff;
            margin: 0 2px;
            font-size: 11px;
            color: #000;
        }
        .pages a:hover
        {
            background-color: #E61636;
            color: #fff;
            border: 1px solid #E61636;
            text-decoration: none;
        }
        .pages .cpb
        {
            font-weight: bold;
            color: #fff;
            background: #E61636;
            border: 1px solid #E61636;
        }
    </style>
    <script type="text/javascript" src="js/jquery.1.4.2-min.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $('.dropdown').hover(
					function () {
					    $(this).children('.sub-menu').slideDown(200);
					},
					function () {
					    $(this).children('.sub-menu').slideUp(200);
					}
				);
        }); // end ready
        $(document).ready(function () {
            $(".good-box:nth-child(4n)").css("margin-right", "0");
        });

        function AddShoppingCar(id) {
            $.ajax({
                type: "get",
                url: "ProductDetail.aspx",
                data: "ope=addnum&productId=" + id + "&num=1&lay=&d=" + new Date().toString(),
                success: function (data) {
                    if (data == "1") {
                        if (callback != null) {
                            callback();
                        }
                        alert("添加成功");
                    }
                    else if (data == "-1") {
                        alert("产品已下架");
                    }
                    else if (data == "-2") {
                        alert("库存不足");
                    }
                    else if (data == "-3") {
                        alert("超出购物限额");
                    }
                    else if (data == "-4") {
                        alert("超出购买限额");
                    }
                    else {
                        alert("添加失败");
                    }
                },
                error: function () {
                    alert("出错啦");
                }
            })
        }	
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <uc1:Header ID="Header1" runat="server" />
    <div class="row bg-garay mar-btm-30">
        <div class="safe_width">
            <div class="adr-box">
                <a href="default.aspx" class="fs-14">首页</a><span> > </span><a href="javascript:;" class="fs-14">最新产品</a>
            </div>
        </div>
    </div>
    <div class="row bg-white">
        <div class="safe_width">
            <div class="box-good goods-list">
                <asp:Repeater ID="Repeater1" runat="server">
                <ItemTemplate>
                <div class="good-box">
                    <div class="good-img">
                        <a href="ProductDetail.aspx?cid=<%#Eval("categoryId") %>&id=<%#Eval("productId") %>"><img src="uploadpic/<%#Eval("pic") %>"></a>
                    </div>
                    <div class="good-des">
                        <p class="good-name">
                            <%#Eval("ProductName")%></p>
                        <div class="goods-buy">
                            <p class="fl">
                                <span class="fs-16">￥</span><%# decimal.Parse(Eval("MarketPrice").ToString()).ToString("f2")%></p>
                            <a href="###" class="fr" onclick="AddShoppingCar(<%#Eval("ProductId") %>)" style="display:none">加入购物车</a>
                        </div>
                    </div>
                </div>
                </ItemTemplate>
                </asp:Repeater>
            </div>
            <div class="page-no mar-top-20">
                <webdiyer:AspNetPager ID="AspNetPager1" CssClass="pages" 
                    CurrentPageButtonClass="cpb" runat="server" UrlPaging="true" 
                    HorizontalAlign="center" PageSize="16" EnableTheming="true" 
                    onpagechanging="AspNetPager1_PageChanging">
                </webdiyer:AspNetPager>
            </div>
        </div>
    </div>
    <uc2:footer ID="footer1" runat="server" />
    </form>
</body>
</html>
